package com.itheima.yanshi;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class Demo {

    public static void main(String[] args) throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {


     /*   Student student = new Student();
        student.study();
        */
      /*  Teacher teacher = new Teacher();
        teacher.xxxx();*/
 /*     Worker worker= new Worker();
      worker.work();*/
        InputStream is = ClassLoader.getSystemResourceAsStream("bean.properties");
        Properties prop = new Properties();
        prop.load(is);
        String classname = prop.getProperty("classname");
        String methodname = prop.getProperty("methodname");
        Class clazz = Class.forName(classname);
        Object o = clazz.getConstructor().newInstance();
        Method method = clazz.getMethod(methodname);
        method.invoke(o);

    }
}
